package com.example.c17310120213_case38_menu_list;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    RecyclerView recyclerView;
    List<FoodBean>list;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        recyclerView = findViewById(R.id.recycleView);

        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.setHasFixedSize(true);

        list = getData();

        MyAdapter myAdapter = new MyAdapter(MainActivity.this,list);

        recyclerView.setAdapter(myAdapter);
    }

    public List<FoodBean>getData(){
        List<FoodBean>list = new ArrayList<FoodBean>();
        FoodBean foodBean;
        foodBean = new FoodBean();
        foodBean.setPictureId(R.drawable.lzj);
        foodBean.setDish_name("辣子鸡");
        foodBean.setFlavor("香辣可口，堪称人间美味");
        foodBean.setDescription("成都市金牛区客舍人家5里路");
        foodBean.setTime("2020-3-9");
        foodBean.setNum("10份");
        list.add(foodBean);

        foodBean = new FoodBean();
        foodBean.setPictureId(R.drawable.bbj);
        foodBean.setDish_name("钵钵鸡");
        foodBean.setFlavor("味香口感丝滑，让人回味无穷");
        foodBean.setDescription("百里园自贡原生态钵钵鸡");
        foodBean.setTime("2020-3-9");
        foodBean.setNum("15份");
        list.add(foodBean);



        foodBean = new FoodBean();
        foodBean.setPictureId(R.drawable.xltds);
        foodBean.setDish_name("香辣土豆丝");
        foodBean.setFlavor("好吃不腻,符合大众口味,物美价廉");
        foodBean.setDescription("做法巧妙,色泽鲜美,独家秘制配方");
        foodBean.setTime("2020-3-9");
        foodBean.setNum("15份");
        list.add(foodBean);


        foodBean = new FoodBean();
        foodBean.setPictureId(R.drawable.hbyh);
        foodBean.setDish_name("火爆腰花");
        foodBean.setFlavor("好吃不腻,符合大众口味,物美价廉");
        foodBean.setDescription("做法巧妙,色泽鲜美,独家秘制配方");
        foodBean.setTime("2020-3-9");
        foodBean.setNum("15份");
        list.add(foodBean);


        foodBean = new FoodBean();
        foodBean.setPictureId(R.drawable.mlj);
        foodBean.setDish_name("麻辣鸡");
        foodBean.setFlavor("现做现卖,毋庸置疑的人间美味");
        foodBean.setDescription("东来路左转300米的人间客舍");
        foodBean.setTime("2020-3-9");
        foodBean.setNum("17份");
        list.add(foodBean);




        foodBean = new FoodBean();
        foodBean.setPictureId(R.drawable.xlfish);
        foodBean.setDish_name("香辣肥鱼");
        foodBean.setFlavor("香辣可口");
        foodBean.setDescription("五里人家27号");
        foodBean.setTime("2020-3-9");
        foodBean.setNum("15份");
        list.add(foodBean);



        return list;
    }
}
